import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:getx_study/get_jump_one/logic.dart';

import 'logic.dart';

class GetJumpTwoPage extends StatelessWidget {

  final GetJumpOneLogic oneLogic = Get.find();
  final GetJumpTwoLogic twoLogic = Get.put(GetJumpTwoLogic());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('跨页面-Two')),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          twoLogic.increase();
          oneLogic.increase();
        },
      ),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            GetBuilder<GetJumpTwoLogic>(
              builder: (twoLogic) {
                return Text('two页面点击了${twoLogic.count}次', style: TextStyle(fontSize: 30),);
              },
            ),
            GetBuilder<GetJumpOneLogic>(
              builder: (oneLogic) {
                return Text('传递的数据${oneLogic.count}次', style: TextStyle(fontSize: 30),);
              },
            ),
          ],
        ),
      ),
    );
  }
}
